/*

  Copyright (C) 2010  INRIA, Planète Team

  Authors:
  ------------------------------------------------------------
   Amir Krifa                        :  krifa.amir@gmail.com
   Chadi Barakat                     :  Chadi.Barakat@sophia.inria.fr
  ------------------------------------------------------------

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3
as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#ifndef LINK_POLICY_MANAGER_H
#define LINK_POLICY_MANAGER_H

class Link;
class Node;

class LinkPolicyManager
{
	/**
	 * Called to initialize the implementation of the LinkPolicyManager
	 * class.
	 * 
	 * @return True if initialization was successful, else false.
	 */
	virtual bool init() = 0;
	
	/**
	 * Called to determine whether a Link object should request DTN
	 * to open an non-open link. Typically a Node object requests
	 * that a link be opened by invoking a method in the link object.
	 * The Link object consults the Policy Manager. The Policy Manager
	 * may then invoke this method for advice.
	 * 
	 * @param link Link object representing the link in question.
	 * @param node Node object requesting that the link be opened.
	 * @return False if not to open, true if the router policy manager
	 *    should decide.
	 */
	virtual bool requestLinkOpen(Link *link, Node *node) = 0;
	
	/**
	 * Called when a link is created.
	 * 
	 * @param link Link object representing the created link.
	 */
	virtual void linkCreated(Link *link) = 0;
	
	/**
	 * Called when a link is deleted.
	 * 
	 * @param link Link object representing the deleted link.
	 */
	virtual void linkDeleted(Link *link) = 0;
	
	/**
	 * Called when a link is opened. This is called before notifying the
	 * link thread.
	 * 
	 * @param link Link object representing the opened link.
	 * @param node Node object associated with the link. Note that this may
	 *    be null.
	 */
	virtual void linkOpened(Link *link, Node *node) = 0;
	
	/**
	 * Called when a link transitions from the open state. lThis is called
	 * after notifying the link thread.
	 * 
	 * @param link Link object representing the closed/unavailable link.
	 * @param node Node object associated with the link. Note that this may
	 *    be null.
	 */
	virtual void linkNotOpen(Link *link, Node *node) = 0;

};


#endif
